#include "WidgetVariantVec2.h"
#include "ui_WidgetVariantVec2.h"
#include <iostream>
#include <QtCore/QVariant>
#include <QtCore/QPointF>

WidgetVariantVec2::WidgetVariantVec2(QWidget *parent) :
    WidgetVariant(parent),
    ui(new Ui::WidgetVariantVec2)
{
    ui->setupUi(this);
    QObject::connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)), 
                     this, SLOT(slotDoubleSpinChanged(double)));
    QObject::connect(ui->doubleSpinBox_2, SIGNAL(valueChanged(double)), 
                     this, SLOT(slotDoubleSpinChanged(double)));
}

WidgetVariantVec2::~WidgetVariantVec2()
{
    delete ui;
}

void WidgetVariantVec2::refreshByProperty( EItemMetaPropertyPtr p)
{
    /*
    WidgetVariant::refreshByProperty(property);
    ui->labelName->setText( property.nameCN.isEmpty() ? property.name : property.nameCN);
    QPointF point = property.value.toPointF();
    ui->doubleSpinBox->setValue(point.x());
    ui->doubleSpinBox_2->setValue(point.y());
    ui->doubleSpinBox->setSuffix(property.unitName);
    ui->doubleSpinBox_2->setSuffix(property.unitName);
    */
}
    
void WidgetVariantVec2::slotDoubleSpinChanged(double value)
{
    // QPointF point(ui->doubleSpinBox->value(), ui->doubleSpinBox_2->value());
    // emit signalVariantChanged(WidgetVariant::getModuleName(),  WidgetVariant::getProperty().name ,QVariant(point));
}
